ServerEvents.recipes(event =>{
    const create = event.recipes.create
    const tfc = event.recipes.tfc
    const incomplete = 'create:incomplete_precision_mechanism'
    const i_b_m = 'kubejs:incompleted_advanced_brass_mesh'
    const i_c_b = 'create:incomplete_precision_mechanism'
    const i_b_p = 'create:incomplete_precision_mechanism'
    const i_a_b = 'create:incomplete_precision_mechanism'
    event.remove('createnuclear:steel_ingot')

    // ae电路板
    create.deploying('ae2:printed_engineering_processor',['#forge:gems/diamond','ae2:engineering_processor_press']).keepHeldItem()
    create.deploying('ae2:printed_silicon',['#forge:silicon','ae2:silicon_press']).keepHeldItem()
    create.deploying('ae2:printed_calculation_processor',['#forge:gems/certus_quartz','ae2:calculation_processor_press']).keepHeldItem()
    create.deploying('ae2:printed_logic_processor',['#forge:sheets/gold','ae2:logic_processor_press']).keepHeldItem()
   
    //安山合金
    create.mixing('create:andesite_alloy',['#forge:nuggets/iron','tfc:rock/cobble/andesite'])
    create.mixing('create:andesite_alloy',['#forge:nuggets/brass','tfc:rock/cobble/andesite'])
    tfc.anvil('create:andesite_alloy', 'kubejs:incompleted_andesite_alloy', ['hit_last','hit_not_last', 'upset_any']).bonus(false)

   // 进阶黄铜筛网
    create.sequenced_assembly([Item.of('createsifter:advanced_brass_mesh').withChance(0.70),
        Item.of('createsifter:brass_mesh').withChance(0.20),
        Item.of('tfc:metal/sheet/steel').withChance(0.10)
    ],
    'createsifter:brass_mesh',
    [
        create.deploying(i_b_m,[i_b_m,'#forge:sheets/steel']),
        create.pressing(i_b_m,i_b_m),
        create.pressing(i_b_m,i_b_m),
        create.pressing(i_b_m,i_b_m)
    ]).transitionalItem(i_b_m).loops(3)

    // 双板合成
    create.compacting('#forge:double_sheets/silver',['#forge:double_sheets/bismuth_bronze','#forge:double_sheets/bismuth_bronze'])
    create.compacting('#forge:double_sheets/silver',['#forge:sheets/silver','#forge:sheets/silver'])
    create.compacting('#forge:double_sheets/gold',['#forge:sheets/gold','#forge:sheets/gold'])
    create.compacting('#forge:double_sheets/nickel',['#forge:sheets/nickel','#forge:sheets/nickel'])
    create.compacting('#forge:double_sheets/rose_gold',['#forge:sheets/rose_gold','#forge:sheets/rose_gold'])
    create.compacting('#forge:double_sheets/wrought_iron',['#forge:sheets/wrought_iron','#forge:sheets/wrought_iron'])
    create.compacting('#forge:double_sheets/brass',['#forge:sheets/brass','#forge:sheets/brass'])
    create.compacting('#forge:double_sheets/bronze',['#forge:sheets/bronze','#forge:sheets/bronze'])
    create.compacting('#forge:double_sheets/tin',['#forge:sheets/tin','#forge:sheets/tin'])
    create.compacting('#forge:double_sheets/zinc',['#forge:sheets/zinc','#forge:sheets/zinc'])
    create.compacting('#forge:double_sheets/bismuth',['#forge:sheets/bismuth','#forge:sheets/bismuth'])
    create.compacting('#forge:double_sheets/copper',['#forge:sheets/copper','#forge:sheets/copper'])
    create.compacting('#forge:double_sheets/black_bronze',['#forge:sheets/black_bronze','#forge:sheets/black_bronze'])
    create.compacting('#forge:double_sheets/sterling_silver',['#forge:sheets/sterling_silver','#forge:sheets/sterling_silver'])
    create.compacting('#forge:double_sheets/steel',['#forge:sheets/steel','#forge:sheets/steel'])
    create.compacting('#forge:double_sheets/black_steel',['#forge:sheets/black_steel','#forge:sheets/black_steel'])
    create.compacting('#forge:double_sheets/red_steel',['#forge:sheets/red_steel','#forge:sheets/red_steel'])

    // 哭泣黑曜石
    create.splashing('minecraft:crying_obsidian','tfc:rock/magma/granite')
    create.splashing('minecraft:crying_obsidian','tfc:rock/magma/diorite')
    create.splashing('minecraft:crying_obsidian','tfc:rock/magma/andesite')
    create.splashing('minecraft:crying_obsidian','tfc:rock/magma/rhyolite')
    create.splashing('minecraft:crying_obsidian','tfc:rock/magma/basalt')
    create.splashing('minecraft:crying_obsidian','tfc:rock/magma/dacite')

    //焦炉
    create.sequenced_assembly([Item.of('immersiveengineering:cokebrick',4)],
    'minecraft:nether_bricks',
    [   create.deploying(i_c_b,[i_c_b,'tfc:ceramic/fire_brick']),
        create.deploying(i_c_b,[i_c_b,'tfc:ceramic/fire_brick']),
        create.deploying(i_c_b,[i_c_b,'#forge:dyes/black']),
        create.deploying(i_c_b,[i_c_b,'enderio:conduit_binder_composite']),
        create.pressing(i_c_b,i_c_b),
        create.pressing(i_c_b,i_c_b)
    ]).transitionalItem(i_c_b).loops(6)
    //合金窑
    event.remove({modid:'create',output:'immersiveengineering:alloybrick'})
    create.sequenced_assembly([Item.of('immersiveengineering:alloybrick',4)],
    'minecraft:bricks',
    [   create.deploying(i_a_b ,[i_a_b ,'tfc:ceramic/fire_brick']),
        create.deploying(i_a_b ,[i_a_b ,'tfc:ceramic/fire_brick']),
        create.deploying(i_a_b ,[i_a_b ,'#tfc:chisels']).keepHeldItem(),
        create.deploying(i_a_b ,[i_a_b ,'enderio:conduit_binder_composite']),
        create.pressing(i_a_b ,i_a_b ),
        create.pressing(i_a_b ,i_a_b )
    ]).transitionalItem(i_a_b ).loops(6)
    //高炉
    create.sequenced_assembly([Item.of('immersiveengineering:blastbrick',27)],
    'tfc:crucible',
    [   create.deploying(i_a_b ,[i_a_b ,'tfc:ceramic/fire_brick']),
        create.deploying(i_a_b ,[i_a_b ,'#forge:double_sheets/any_bronze']),
        create.deploying(i_a_b ,[i_a_b ,'#tfc:hammers']).keepHeldItem(),
        create.deploying(i_a_b ,[i_a_b ,'tfc:ceramic/fire_brick']),
        create.deploying(i_a_b ,[i_a_b ,'#tfc:hammers']).keepHeldItem(),
        create.pressing(i_a_b ,i_a_b )
    ]).transitionalItem(i_a_b ).loops(8)
    create.sequenced_assembly([Item.of('immersiveengineering:blastbrick',27)],
    'tfc:crucible',
    [   create.deploying(i_a_b ,[i_a_b ,'tfc:ceramic/fire_brick']),
        create.deploying(i_a_b ,[i_a_b ,'tfc:metal/sheet/wrought_iron']),
        create.deploying(i_a_b ,[i_a_b ,'#tfc:hammers']).keepHeldItem(),
        create.deploying(i_a_b ,[i_a_b ,'tfc:ceramic/fire_brick']),
        create.deploying(i_a_b ,[i_a_b ,'#tfc:hammers']).keepHeldItem(),
        create.pressing(i_a_b ,i_a_b )
    ]).transitionalItem(i_a_b ).loops(10)
    //强化高炉砖
    event.remove({modid:'create',output:'immersiveengineering:blastbrick_reinforced'})
    create.sequenced_assembly([Item.of('immersiveengineering:blastbrick_reinforced',1)],
    'immersiveengineering:blastbrick',
    [   create.deploying(i_b_p,[i_b_p,'tfc:metal/sheet/steel']),
        create.deploying(i_b_p,[i_b_p,'tfc:kaolin_clay']),
        create.deploying(i_b_p,[i_b_p,'enderio:conduit_binder_composite']),
        create.pressing(i_b_p,i_b_p),
    ]).transitionalItem(i_b_p).loops(1)
    //导管粘合剂
    event.remove('enderio:conduit_binder_composite')
    create.mixing(Item.of('enderio:conduit_binder_composite',8),[Fluid.water(100),Item.of('#forge:sand',2),Item.of('#forge:gravel',5),Item.of('#forge:clay',2)])
    create.mixing(Item.of('enderio:conduit_binder_composite',16),[Fluid.water(100),Item.of('#forge:sand',2),Item.of('#forge:gravel',5),Item.of('tfc:glue',2)]).heated()
    //搅拌器

    //扇叶
    event.replaceInput({output:'create:propeller'},'#forge:plates/iron','tfc:metal/sheet/wrought_iron')
    create.compacting('create:propeller',[Item.of('create:iron_sheet',4),'create:andesite_alloy'])
    //锯片
    tfc.anvil('thermal:saw_blade', 'tfc:metal/double_sheet/wrought_iron', ['shrink_any','bend_not_last', 'draw_any']).bonus(false)
    //附魔台
    create.sequenced_assembly([Item.of('minecraft:enchanting_table',1)],
    'kubejs:incompleted_enchanting_table',
    [   create.deploying(incomplete,[incomplete,'minecraft:book']),
        create.filling(incomplete,[({fluidTag:'forge:experience',amount:1250}),incomplete]),
        create.pressing(incomplete,incomplete)
    ]).transitionalItem(incomplete).loops(1)
   //方坯
    create.sequenced_assembly('tfc:refined_iron_bloom',
    'tfc:raw_iron_bloom',
    [
        create.pressing(incomplete,incomplete),
        create.pressing(incomplete,incomplete),
        create.pressing(incomplete,incomplete),
        create.pressing(incomplete,incomplete)
    ]
    ).transitionalItem(incomplete).loops(1)
    //生铁->高碳->钢锭
    create.mixing('2x tfc:metal/ingot/high_carbon_steel',['#forge:dusts/coal_coke','2x tfc:metal/ingot/pig_iron']).superheated()
    create.mixing(Item.of('tfc:metal/ingot/steel',2),[Item.of('tfc:metal/ingot/high_carbon_steel',2),'minecraft:blaze_powder',Item.of('tfc:powder/flux',3)]).superheated()
    //其他高碳锭配方
    //吸管
    event.custom({
        "type":"createaddition:rolling",
        "input": {
              "item": "immersiveengineering:gunpart_barrel"
        },
        "result": {
            "item": "createaddition:straw",
            "count": 1
        }
    })
    //铅出核反应框架
    event.shapeless('immersiveengineering:storage_lead','9x #forge:ingots/lead')
    event.remove({output:'anvilcraft:lead_block'})
    event.remove({output:'createnuclear:lead_block'})
    event.remove({output:'createnuclear:reactor_casing',type:'create:item_application'})
    event.stonecutting('8x createnuclear:reactor_casing','immersiveengineering:storage_lead')
    //树脂变助焊剂
    tfc.quern('tfc:powder/flux','anvilcraft:resin')
    create.milling(['tfc:powder/flux',Item.of('tfc:powder/flux').withChance(0.65)],'anvilcraft:resin')
    create.milling('enderio:powdered_coal','#minecraft:coals')
    create.sequenced_assembly([Item.of('anvilcraft:hardend_resin')
    ],'anvilcraft:resin',[
        create.pressing(i_b_m,i_b_m),
        create.pressing(i_b_m,i_b_m),
        create.pressing(i_b_m,i_b_m)
    ]).transitionalItem(i_b_m).loops(1)
    create.compacting('6x anvilcraft:hardend_resin',Fluid.of('immersiveengineering:phenolic_resin',100))
    create.compacting('2x anvilcraft:hardend_resin','thermal:rubber')
    create.compacting('4x thermal:rubber',Fluid.of('thermal:latex',1000))
    create.mixing('2x thermal:cured_rubber',[Fluid.of('thermal:latex',500),'tfc:powder/sulfur']).heated()
    //量产木制纤维
    create.compacting('anvilcraft:wood_fiber','tfc:stick_bundle')
    create.mixing('anvilcraft:resin',Fluid.of('thermal:sap',50)).heated()
    create.mixing(Fluid.of('thermal:sap',50),'anvilcraft:wood_fiber').heated()
    //砂砾、沙子
    create.milling('tfc:rock/gravel/andesite','#forge:cobblestone')
    create.crushing(['tfc:rock/gravel/andesite',Item.of('minecraft:flint').withChance(0.08)],'#forge:cobblestone')
    create.milling('tfc:sand/black','#forge:gravel')
    //灵质
    create.filling('goety:ectoplasm',[{fluidTag:'forge:experience',amount:100},'#forge:gems/lapis'])
    //树肥
    create.mixing('create:tree_fertilizer',['thermal:phytogro','immersiveengineering:fertilizer','minecraft:bone_meal'])
    //热力的经验
    create.emptying([Fluid.of('cofh_core:experience',250), 'minecraft:glass_bottle'], 'minecraft:experience_bottle')
    //食物配方修改
    event.remove({modid:'create',output:(Fluid.of('create:chocolate'))})
    create.mixing(Fluid.of('create:chocolate',1000),'#firmalife:chocolate_blends').heated()
    create.mixing(Fluid.of('create:honey',1000),'firmalife:raw_honey').heated()
    event.replaceInput({modid:'create',output:'create:honeyed_apple'},'minecraft:apple','tfc:food/red_apple')
    create.filling('create:honeyed_apple',[{fluidTag:'forge:honey',amount:1000},'tfc:food/green_apple'])
    create.mixing(Fluid.of('create:tea',500),[Fluid.water(250),{fluidTag:'tfc:milks',amount:250},'#minecraft:leaves']).heated()
    create.filling('create:sweet_roll',['#tfc:foods/dough',{fluidTag:'tfc:milks',amount:125}])
    create.filling('create:chocolate_glazed_berries',['tfc:food/gooseberry',Fluid.of('create:chocolate',125)])
    create.filling('create:chocolate_glazed_berries',['tfc:food/cranberry',Fluid.of('create:chocolate',125)])
    //ad钢棒制作
    event.custom({
        "type":"createaddition:rolling",
        "input": {
              "tag": "forge:plates/steel"
        },
        "result": {
            "item": "ad_astra:steel_rod",
            "count": 2
        }
    });
    //玻璃瓶
    create.sequenced_assembly('2x tfc:empty_jar',
    '#tfc:glass_batches',
    [   create.filling(i_a_b,[Fluid.lava(50),i_a_b]),
        create.deploying(i_a_b ,[i_a_b ,'tfc:blowpipe']).keepHeldItem(),
        create.deploying(i_a_b ,[i_a_b ,'tfc:jacks']).keepHeldItem(),
        create.deploying(i_a_b ,[i_a_b ,'tfc:wool_cloth']).keepHeldItem(),
        create.deploying(i_a_b ,[i_a_b ,'tfc:gem_saw']).keepHeldItem(),
    ]).transitionalItem(i_a_b ).loops(2);
    create.sequenced_assembly('2x tfc:silica_glass_bottle',
    'tfc:silica_glass_batch',
    [   create.filling(i_a_b,[Fluid.lava(50),i_a_b]),
        create.deploying(i_a_b ,[i_a_b ,'tfc:blowpipe']).keepHeldItem(),
        create.deploying(i_a_b ,[i_a_b ,'tfc:jacks']).keepHeldItem(),
        create.deploying(i_a_b ,[i_a_b ,'tfc:gem_saw']).keepHeldItem(),
    ]).transitionalItem(i_a_b ).loops(1);
    create.sequenced_assembly('2x tfc:hematitic_glass_bottle',
    'tfc:hematitic_glass_batch',
    [   
        create.filling(i_a_b,[Fluid.lava(50),i_a_b]),
        create.deploying(i_a_b ,[i_a_b ,'tfc:blowpipe']).keepHeldItem(),
        create.deploying(i_a_b ,[i_a_b ,'tfc:jacks']).keepHeldItem(),
        create.deploying(i_a_b ,[i_a_b ,'tfc:gem_saw']).keepHeldItem(),
    ]).transitionalItem(i_a_b ).loops(1);
    create.sequenced_assembly('2x tfc:olivine_glass_bottle',
    'tfc:olivine_glass_batch',
    [   create.filling(i_a_b,[Fluid.lava(50),i_a_b]),
        create.deploying(i_a_b ,[i_a_b ,'tfc:blowpipe']).keepHeldItem(),
        create.deploying(i_a_b ,[i_a_b ,'tfc:jacks']).keepHeldItem(),
        create.deploying(i_a_b ,[i_a_b ,'tfc:gem_saw']).keepHeldItem(),
    ]).transitionalItem(i_a_b ).loops(1);
    create.sequenced_assembly('2x kubejs:raw_pyrolusite',
    'kubejs:pyrolusite',
    [   
        create.pressing(incomplete,incomplete),
        create.filling(i_a_b,[Fluid.water(200),i_a_b]),
        create.pressing(incomplete,incomplete),
        create.deploying(i_a_b ,[i_a_b ,'anvilcraft:magnet_block']).keepHeldItem(),
    ]).transitionalItem(i_a_b ).loops(5);

    const bm = [['bloodmagic:bettercapacityrune','bloodmagic:altarcapacityrune','immersiveengineering:metal_barrel'],
    ['bloodmagic:altarcapacityrune','kubejs:rune_of_level','#tfc:barrels'],
    ['bloodmagic:accelerationrune','bloodmagic:speedrune','minecraft:sugar'],
    ['bloodmagic:dislocationrune','kubejs:rune_of_level','create:mechanical_pump'],
    ['bloodmagic:orbcapacityrune','kubejs:rune_of_level','bloodmagic:weakbloodorb']]
    bm.forEach(item =>{
        create.sequenced_assembly(item[0],
        item[1],
        [
            create.deploying(incomplete,[incomplete,item[2]]),
            create.pressing(incomplete,incomplete),
        ]
    ).transitionalItem(incomplete).loops(1);

    create.sequenced_assembly((item[0]+'2'),
    (item[1]+'2'),
    [
        create.filling(incomplete,[(Fluid.of('bloodmagic:life_essence_fluid',500)),incomplete]),
        create.deploying(incomplete,[incomplete,item[2]]),
    ]
    ).transitionalItem(incomplete).loops(1);
    });
    create.compacting('anvilcraft:nether_dust',['2x create:cinder_flour','#minecraft:sand'])
    create.compacting('anvilcraft:end_dust',['2x minecraft:popped_chorus_fruit','#minecraft:sand'])
    create.compacting('tfc:stick_bundle','2x tfc:stick_bunch')
    create.compacting('tfc:stick_bunch','4x #forge:rods/wooden')
    create.mixing(Fluid.of('kubejs:melting_titanium_aluminum_alloy',1000),[Fluid.of('kubejs:melting_high_purity_aluminum',500),'36x anvilcraft:titanium_nugget','kubejs:manganese_mineral_powder']).superheated()

    event.custom({
    "type": "create_new_age:energising",
    "energy_needed": 1000000,
    "ingredients": [
        {
        "item": "kubejs:raw_pyrolusite",
        }
    ],
    "results": [
        {
        "item": "kubejs:manganese_mineral_powder",
        }
    ]
    })
    create.emptying([Fluid.of('bloodmagic:life_essence_fluid',500)], 'kubejs:condensed_blood')
    create.sequenced_assembly(Item.of('tacz:ammo').withNBT({AmmoId: "tacz:rpg_rocket"}),
    'immersiveengineering:plate_aluminum',
    [   
        create.deploying(i_a_b ,[i_a_b ,'prma:high_power_ammunition_gunpowder']),
        create.deploying(i_a_b ,[i_a_b ,'prma:high_power_ammunition_gunpowder']),
        create.deploying(i_a_b ,[i_a_b ,'prma:high_power_ammunition_gunpowder']),
        create.pressing(i_a_b,i_a_b),
        create.deploying(i_a_b ,[i_a_b ,'kubejs:aluminum_alloy']),
        create.deploying(i_a_b ,[i_a_b ,'kubejs:aluminum_alloy']),
        create.pressing(i_a_b,i_a_b)
    ]).transitionalItem(i_a_b ).loops(1);
    create.sequenced_assembly(Item.of('tacz:ammo', '{AmmoId:"tacz:40mm"}'),
    'prma:40mm_casing',
    [   
        create.deploying(i_a_b ,[i_a_b ,'prma:high_power_ammunition_gunpowder']),
        create.deploying(i_a_b ,[i_a_b ,'prma:40mm_slug']),
        create.pressing(i_a_b,i_a_b)
    ]).transitionalItem(i_a_b ).loops(1);
    //跟腱
    create.pressing('bsa:dried_sinew','bsa:pounded_sinew')
    event.shapeless('create:cogwheel',['enderio:wood_gear','create:shaft'])
    //水车
    event.remove({output:'create:water_wheel'})
    event.replaceInput({output:"create:large_water_wheel"},'create:water_wheel','tfc:wood/water_wheel/willow')
    event.shaped('create:large_water_wheel',['ABA','BCB','ABA'],{A:"#tfc:lumber",B:"#minecraft:planks",C:"create:water_wheel"})
    event.shaped('create:water_wheel',['ABA','BCB','ABA'],{A:"#tfc:lumber",B:"#minecraft:planks",C:"create:shaft"})
    create.mixing('prma:high_power_ammunition_gunpowder',['prma:long_ammunition_gunpowder','minecraft:gunpowder'])
});

//为烈焰蛋糕添加保质期,另外注册其他create食物
TFCEvents.data(event => {
    event.foodItem('create:blaze_cake', food => {
        food.decayModifier(2)
    })
    event.foodItem('create:bar_of_chocolate', food =>{
        food.hunger(2),
        food.saturation(2),
        food.decayModifier(0.2),
        food.protein(0.2),
        food.dairy(0.5)
    })
    event.foodItem('create:sweet_roll', food =>{
        food.hunger(4),
        food.decayModifier(5),
        food.grain(1),
        food.dairy(0.3)
    })
    event.foodItem('create:honeyed_apple', food =>{
        food.hunger(4),
        food.saturation(4),
        food.decayModifier(0.5)
        food.fruit(1)
    })
    event.foodItem('create:chocolate_glazed_berries', food =>{
        food.hunger(4),
        food.saturation(1),
        food.decayModifier(1)
        food.fruit(0.8)
    })
    event.foodItem('create:builders_tea', food =>{
        food.decayModifier(7.5)
    })
})
